/*
 * HttpListaBens.java
 *
 * Created on 27 de Maio de 2007, 23:15
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.connection;

import com.valueObjects.ListaBens;
import com.view.MainMenuForm;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.Hashtable;

/**
 *
 * @author Gustavo
 */
public class HttpListaBens extends HttpMobile{
    
    public MainMenuForm form;
    
    public boolean logged;

    private static HttpListaBens instance;
    
    private HttpListaBens(String url, MainMenuForm f) {
        this.form = f;
        this.url = url;
    }
    
    public static HttpListaBens getInstance(String url, MainMenuForm f) {
    if(instance == null){
            instance = new HttpListaBens(url,f);
        }
        return instance;
    }

    public void doGet(Hashtable parameters) {
    }

    public void doResponse(DataInputStream dataIn) {
        try {
            logged = dataIn.readBoolean();
            if(logged) {
                int size = dataIn.available();
                byte[] data = new byte[size];
                dataIn.read(data);
                form.goListaBens(data);
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }        
    }
    
}
